package com.hqyj.dao;

import com.hqyj.pojo.ManagerManagerInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ManagerManagerInfoDao {
    //查询
    @Select("select * from managerInfo ")
    List<ManagerManagerInfo> select();
    //根据managerId查询
    @Select("select * from managerInfo where managerId=#{managerId}")
    ManagerManagerInfo selectByManagerId(ManagerManagerInfo manager);
    //修改
    @Update("update managerInfo set managerName=#{managerName},managerNickName=#{managerNickName} ,managerPwd=#{managerPwd},managerRightLevel=#{managerRightLevel},managerSex=#{managerSex},managerBirth=#{managerBirth},managerTel=#{managerTel},managerEmail=#{managerEmail},managerEdu=#{managerEdu},managerIdCard=#{managerIdCard},managerText=#{managerText} where managerId=#{managerId}")
    int update(ManagerManagerInfo manager);

    //验证用户名是否重名
    @Select("select count(*) from managerInfo where managerName=#{managerName}")
    int valName(ManagerManagerInfo manager);
    //删除
    @Delete("delete from managerInfo where managerId=#{managerId}")
    int del(ManagerManagerInfo manager);
    //根据编号查询
    @Select("select * from managerInfo where managerId=#{managerId}")
    List<ManagerManagerInfo> findByManagerId(ManagerManagerInfo manager);

    //根据用户名查询
    @Select("select * from managerInfo where managerName=#{managerName}")
    List<ManagerManagerInfo> findByManagerName(ManagerManagerInfo manager);

    //新建
    @Insert("insert into managerInfo(managerId,managerNickName,salt,managerPwd,managerRightLevel,managerName,managerSex,managerBirth,managerTel,managerEmail,managerEdu,managerIdCard,managerText)value(#{managerId},#{managerNickName},#{salt},#{managerPwd},#{managerRightLevel},#{managerName},#{managerSex},#{managerBirth},#{managerTel},#{managerEmail},#{managerEdu},#{managerIdCard},#{managerText})")
    int xinjian(ManagerManagerInfo manager);

}
